﻿@{
    Layout = null;
}
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <h4 class="modal-title">
                <strong>修改密码</strong>
            </h4>
        </div>
        <div class="modal-body">
            <form action="" class="form-horizontal" id="modifyPass" method="post" role="form">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label for="object" class="col-sm-2 control-label">
                            旧密码:
                        </label>
                        <div class="col-sm-9">
                            <input type="text" name="OldPassWord" id="oldPassWord" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="Value" class="col-sm-2 control-label">
                            新密码:
                        </label>
                        <div class="col-sm-9">
                            <input type="text" name="NewPassWord" id="newPassWord" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="isAgree" class="col-sm-2 control-label">
                            确认密码:
                        </label>
                        <div class="col-sm-9">
                            <input type="text" name="ConfirmPassWord" id="confirmPassWord" class="form-control equalTo:$('#newPassWord')" />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" onclick="SubmitPwdForm();" class="btn btn-default">
                        提交
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
function SubmitPwdForm() {
    if ($('#modifyPass').valid()) {
        showLoading("正在修改密码...");
        $.ajax({
            type: 'POST',
            url: "/Users/ModifyPassWord",
            data: $('#modifyPass').serialize(),
            dataType: 'json',
            success: function (data) {
                if (data.ResultState == true) {
                    hideLoading();
                    alert("修改完成");
                }
                else {
                    hideLoading();
                    alert(data.Message);
                }
            },
            error: function () {
                hideLoading();
                alert("修改失败");
            }
        });
    }
}
</script>